package com.ironone.mediaplayerdemo;

import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SlidingPaneLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;

import com.ironone.mediaplayerdemo3.R;

public class Frag2 extends Fragment {

	//Fragment s;
	Button dragIcon;
	SlidingPaneLayout mPane;

	@Override
	public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {

		View view = inflater.inflate(R.layout.frag_two, container, false);
		mPane = (SlidingPaneLayout) getActivity().findViewById(R.id.pane);	
		dragIcon = (Button) view.findViewById(R.id.dragicon);

		//s = this;

		dragIcon.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				common();
			}
		});		
		return view;
	}


	private void common(){
		dragIcon.setClickable(false);
		new Handler().postDelayed(new Runnable() {

			@Override
			public void run() {
				dragIcon.setClickable(true);
			}
		}, 1000);


		mPane.openPane();
		//mPane.setShadowResource(R.drawable.player);
		//mPane.setSliderFadeColor(600 * 0x1000000);
		//mPane.setParallaxDistance(50);

		// Create new fragment and transaction
		//Frag1 newFragment = new Frag1();
		//FragmentTransaction transaction = getFragmentManager().beginTransaction();
		//transaction.setCustomAnimations(0, R.anim.slide_middle_to_right);
		// Replace whatever is in the fragment_container view with this fragment,
		// and add the transaction to the back stack
		//transaction.remove(s);
		//transaction.addToBackStack(null);
		// Commit the transaction
		//transaction.commit();
	}
}
